﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace FODATAC.Test.NorthWind
{
	[DataContract(Namespace = "ODataDemo")]
	public class FeaturedProduct : Product
	{
		[DataMember]
		public Advertisement Advertisement { get; set; }
	}
	[DataContract(Namespace = "ODataDemo")]
	public class Advertisement
	{
		[DataMember]
		public int ID { get;  set; }

		[DataMember]
		public string Name { get; set; }
		[DataMember]
		public DateTime AirDate { get; set; }
		[DataMember]
		public FeaturedProduct FeaturedProduct { get; set; }
	}
	[KnownType(typeof(FeaturedProduct))]
	[DataContract(Namespace = "ODataDemo")]
	public class Product
	{
		[DataMember(Name = "Categories")]
		readonly ICollection<Category> categories = new List<Category>();
		[DataMember]
		public int ID { get; private set; }
		[DataMember]
		public string Name { get; set; }
		[DataMember]
		public string Description { get; set; }
		[DataMember]
		public DateTimeOffset ReleaseDate { get; set; }
		[DataMember]
		public DateTimeOffset DiscontinuedDate { get; set; }
		[DataMember]
		public short Rating { get; set; }
		[DataMember]
		public double Price { get; set; }
		public ICollection<Category> Categories { get { return this.categories; } }
		[DataMember]
		public Supplier Supplier { get; set; }
	}
	[DataContract(Namespace = "ODataDemo")]
	public class ProductDetail
	{
		[DataMember]
		public int ProductId { get; set; }
		[DataMember]
		public string Details { get; set; }
		[DataMember]
		public Product Product { get; set; }
	}
	[DataContract(Namespace = "ODataDemo")]
	public class Category
	{
		[DataMember(Name = "Products")]
		readonly ICollection<Product> products = new List<Product>();
		[DataMember]
		public int ID { get; private set; }
		[DataMember]
		public string Name { get; set; }
		public ICollection<Product> Products { get { return this.products; } }

	}
	[DataContract(Namespace = "ODataDemo")]
	public class Supplier
	{
		[DataMember(Name = "Products")]
		readonly ICollection<Product> products = new List<Product>();
		[DataMember]
		public int ID { get; set; }
		[DataMember]
		public Address Address { get; set; }
		[DataMember]
		public string Name { get; set; }
		[DataMember]
		public object Location { get; set; }
		[DataMember]
		public int Concurrency { get; set; }
		public ICollection<Product> Products { get { return this.products; } }
	}
	[DataContract(Namespace = "ODataDemo")]
	public class Address
	{
		[DataMember]
		public string Street { get; set; }
		[DataMember]
		public string City { get; set; }
		[DataMember]
		public string State { get; set; }
		[DataMember]
		public string ZipCode { get; set; }
		[DataMember]
		public string Country { get; set; }
	}

}
